package com.iot.web.form;

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.witsight.platform.model.BoEntity;
import com.witsight.platform.model.IBaseObject;

/**   
 * 说明：form实体继承此抽象对象
 * @Title: BaseForm.java 
 * @Package com.witsight.web.form 
 * @See: {@link #BaseForm()}
 * 		 {@link IBaseObject}
 * Copyright: Copyright (c) 2017
 * @author: penght  
 * @date: 2017年10月10日 下午3:07:22 
 * @version: V1.0
 *
 */
public class BaseForm <T extends IBaseObject> implements IBaseObject {
	private static final long serialVersionUID = 3400606616777008491L;	
	// 公共日志对象
	protected final Logger log = LoggerFactory.getLogger(this.getClass());
	// 实体对象，需要继承的模型
	private T model;
	
	//@Valid
	public T getModel() {
		return model;
	}

	public void setModel(T model) {
		this.model = model;
	}

	/**
	 * 
	 * 说明：转换动态Bean,作为参数
	 * @Title: toBoEntity
	 * @See: {@link #toBoEntity()}
	 * @author penght 
	 * @return BoEntity 
	 * @date: Jun 17, 2017 8:44:22 PM
	 */
	public BoEntity toBoEntity() {
		if (log.isDebugEnabled()) {
			log.debug("Form Change BoEntity.");
		}
		return BeanConverter.toBoEntity(this);
	}
}